home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / comms_w / mslot12.zip / SAMPLE.ZIP / MSSAMPLE.FRM < prev    next >
Text File  |  1995-02-02  |  11KB  |  371 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "MSlot VBX Sample"
  5.    ClientHeight    =   6615
  6.    ClientLeft      =   1260
  7.    ClientTop       =   2265
  8.    ClientWidth     =   7590
  9.    Height          =   7020
  10.    Left            =   1200
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   6615
  13.    ScaleWidth      =   7590
  14.    Top             =   1920
  15.    Width           =   7710
  16.    Begin Frame Frame4 
  17.       Caption         =   "Write Message"
  18.       Height          =   1815
  19.       Left            =   3360
  20.       TabIndex        =   24
  21.       Top             =   2880
  22.       Width           =   4095
  23.       Begin TextBox txtWriteMessage 
  24.          Height          =   285
  25.          Left            =   1320
  26.          TabIndex        =   29
  27.          Text            =   "Test Message"
  28.          Top             =   720
  29.          Width           =   2535
  30.       End
  31.       Begin CommandButton btnWrite 
  32.          Caption         =   "Write Message to Mailslot"
  33.          Height          =   420
  34.          Left            =   240
  35.          TabIndex        =   27
  36.          Top             =   1200
  37.          Width           =   3615
  38.       End
  39.       Begin TextBox txtWriteMailslotName 
  40.          Height          =   285
  41.          Left            =   1320
  42.          TabIndex        =   25
  43.          Text            =   "\mailslot\atest"
  44.          Top             =   360
  45.          Width           =   2535
  46.       End
  47.       Begin Label Label4 
  48.          Caption         =   "Message:"
  49.          Height          =   255
  50.          Left            =   240
  51.          TabIndex        =   0
  52.          Top             =   720
  53.          Width           =   975
  54.       End
  55.       Begin Label Label1 
  56.          Caption         =   "Name:"
  57.          Height          =   255
  58.          Left            =   240
  59.          TabIndex        =   26
  60.          Top             =   360
  61.          Width           =   975
  62.       End
  63.    End
  64.    Begin VBMailslots Mailslot1 
  65.       Height          =   420
  66.       Interval        =   0
  67.       Left            =   6480
  68.       MailslotName    =   "\mailslot\atest"
  69.       MailslotSize    =   1024
  70.       Message         =   ""
  71.       MessageSize     =   256
  72.       Priority        =   1
  73.       Timeout         =   2005
  74.       Top             =   0
  75.       Width           =   420
  76.    End
  77.    Begin Frame Frame3 
  78.       Caption         =   "User/Machine Information"
  79.       Height          =   1215
  80.       Left            =   3360
  81.       TabIndex        =   12
  82.       Top             =   1560
  83.       Width           =   4095
  84.       Begin Label lblWorkgroupName 
  85.          Caption         =   "lblWorkgroupName"
  86.          Height          =   255
  87.          Left            =   1920
  88.          TabIndex        =   18
  89.          Top             =   840
  90.          Width           =   1935
  91.       End
  92.       Begin Label Label12 
  93.          Caption         =   "Workgroup Name:"
  94.          Height          =   255
  95.          Left            =   240
  96.          TabIndex        =   17
  97.          Top             =   840
  98.          Width           =   1575
  99.       End
  100.       Begin Label lblComputerName 
  101.          Caption         =   "lblComputerName"
  102.          Height          =   255
  103.          Left            =   1920
  104.          TabIndex        =   16
  105.          Top             =   600
  106.          Width           =   1935
  107.       End
  108.       Begin Label Label11 
  109.          Caption         =   "ComputerName:"
  110.          Height          =   255
  111.          Left            =   240
  112.          TabIndex        =   15
  113.          Top             =   600
  114.          Width           =   1575
  115.       End
  116.       Begin Label lblUserName 
  117.          Caption         =   "lblUserName"
  118.          Height          =   255
  119.          Left            =   1920
  120.          TabIndex        =   14
  121.          Top             =   360
  122.          Width           =   1935
  123.       End
  124.       Begin Label Label10 
  125.          Caption         =   "User Name:"
  126.          Height          =   255
  127.          Left            =   240
  128.          TabIndex        =   13
  129.          Top             =   360
  130.          Width           =   1575
  131.       End
  132.    End
  133.    Begin Frame Frame2 
  134.       Caption         =   "Mailslot Management"
  135.       Height          =   4575
  136.       Left            =   120
  137.       TabIndex        =   10
  138.       Top             =   120
  139.       Width           =   3015
  140.       Begin CommandButton btnDelete 
  141.          Caption         =   "Delete"
  142.          Enabled         =   0   'False
  143.          Height          =   420
  144.          Left            =   1560
  145.          TabIndex        =   23
  146.          Top             =   960
  147.          Width           =   1215
  148.       End
  149.       Begin CommandButton btnMake 
  150.          Caption         =   "Make"
  151.          Height          =   420
  152.          Left            =   240
  153.          TabIndex        =   22
  154.          Top             =   960
  155.          Width           =   1215
  156.       End
  157.       Begin TextBox txtMessage 
  158.          Enabled         =   0   'False
  159.          Height          =   2055
  160.          Left            =   240
  161.          MultiLine       =   -1  'True
  162.          TabIndex        =   21
  163.          Top             =   1800
  164.          Width           =   2535
  165.       End
  166.       Begin CommandButton btnRead 
  167.          Caption         =   "Read Next Message"
  168.          Enabled         =   0   'False
  169.          Height          =   420
  170.          Left            =   240
  171.          TabIndex        =   19
  172.          Top             =   3960
  173.          Width           =   2535
  174.       End
  175.       Begin TextBox txtMailslotName 
  176.          Height          =   285
  177.          Left            =   240
  178.          TabIndex        =   11
  179.          Text            =   "\mailslot\atest"
  180.          Top             =   600
  181.          Width           =   2535
  182.       End
  183.       Begin Label Label2 
  184.          Caption         =   "Message:"
  185.          Enabled         =   0   'False
  186.          Height          =   255
  187.          Left            =   240
  188.          TabIndex        =   20
  189.          Top             =   1560
  190.          Width           =   1095
  191.       End
  192.       Begin Label Label9 
  193.          Caption         =   "Name:"
  194.          Height          =   225
  195.          Left            =   240
  196.          TabIndex        =   3
  197.          Top             =   360
  198.          Width           =   1560
  199.       End
  200.    End
  201.    Begin Timer Timer1 
  202.       Enabled         =   0   'False
  203.       Interval        =   100
  204.       Left            =   6960
  205.       Top             =   0
  206.    End
  207.    Begin Frame Frame1 
  208.       Caption         =   "Peek (Next Message)"
  209.       Height          =   1215
  210.       Left            =   3360
  211.       TabIndex        =   5
  212.       Top             =   240
  213.       Width           =   4095
  214.       Begin Label Label8 
  215.          Caption         =   "NextPriority:"
  216.          Height          =   270
  217.          Left            =   240
  218.          TabIndex        =   1
  219.          Top             =   840
  220.          Width           =   1035
  221.       End
  222.       Begin Label Label7 
  223.          Caption         =   "NextSize:"
  224.          Height          =   255
  225.          Left            =   240
  226.          TabIndex        =   2
  227.          Top             =   600
  228.          Width           =   960
  229.       End
  230.       Begin Label Label6 
  231.          Caption         =   "Message:"
  232.          Height          =   255
  233.          Left            =   240
  234.          TabIndex        =   9
  235.          Top             =   360
  236.          Width           =   1215
  237.       End
  238.       Begin Label lblNextSize 
  239.          Caption         =   "lblNextSize"
  240.          Height          =   240
  241.          Left            =   1920
  242.          TabIndex        =   8
  243.          Top             =   600
  244.          Width           =   2055
  245.       End
  246.       Begin Label lblNextPriority 
  247.          Caption         =   "lblNextPriority"
  248.          Height          =   240
  249.          Left            =   1920
  250.          TabIndex        =   7
  251.          Top             =   840
  252.          Width           =   2085
  253.       End
  254.       Begin Label lblNextMessage 
  255.          Caption         =   "lblNextMessage"
  256.          Height          =   240
  257.          Left            =   1920
  258.          TabIndex        =   6
  259.          Top             =   360
  260.          Width           =   1965
  261.       End
  262.    End
  263.    Begin Label Label5 
  264.       Caption         =   "You can run this program on two different machines.  Use one machine to read the messages and use the other to write them.  This makes a good test program for your applications that use MSlot VBX."
  265.       Height          =   735
  266.       Left            =   120
  267.       TabIndex        =   4
  268.       Top             =   5760
  269.       Width           =   7335
  270.    End
  271.    Begin Label Label3 
  272.       Caption         =   "Create a mailslot using the Mailslot Management Make button.  Then, using the write message controls to write a message to this mailslot.  Notice the change in the Peek (Next Message) fields.  Finally, use the Read Next Message button to retrieve the message from the mailslot."
  273.       Height          =   855
  274.       Left            =   120
  275.       TabIndex        =   28
  276.       Top             =   4800
  277.       Width           =   7335
  278.    End
  279. End
  280.  
  281. Sub btnDelete_Click ()
  282.     ' shut down mailslot
  283.     Timer1.Enabled = False
  284.     Mailslot1.Action = MSLOT_DELETE
  285.  
  286.     ' re-enable the make stuff
  287.     btnMake.Enabled = True
  288.     txtMailslotName.Enabled = True
  289.  
  290.     ' reset display info
  291.     Label2.Enabled = False
  292.     txtMessage = ""
  293.     txtMessage.Enabled = False
  294.     btnDelete.Enabled = False
  295.     btnRead.Enabled = False
  296.     txtMailslotName.Enabled = True
  297.  
  298.     lblNextMessage = "N/A"
  299.     lblNextSize = "N/A"
  300.     lblNextPriority = "N/A"
  301. End Sub
  302.  
  303. Sub btnMake_Click ()
  304.     ' make the mailslot
  305.     Mailslot1.MailslotName = txtMailslotName
  306.     Mailslot1.Action = MSLOT_OPEN
  307.  
  308.     ' make button and edit box are useless now
  309.     btnMake.Enabled = False
  310.     txtMailslotName.Enabled = False
  311.  
  312.     ' enable other controls
  313.     Timer1.Enabled = True
  314.     btnRead.Enabled = True
  315.     btnDelete.Enabled = True
  316.     Label2.Enabled = True
  317.     txtMessage.Enabled = True
  318. End Sub
  319.  
  320. Sub btnRead_Click ()
  321.     Mailslot1.Action = MSLOT_READ
  322.     
  323.     If txtMessage <> "" Then
  324.         txtMessage = txtMessage & Chr(13) & Chr(10)
  325.     End If
  326.  
  327.     txtMessage = txtMessage & Mailslot1.Message
  328.  
  329.     ' clear message buffer
  330.     Mailslot1.Message = ""
  331. End Sub
  332.  
  333. Sub btnWrite_Click ()
  334.     Mailslot1.MailslotName = txtWriteMailslotName
  335.     Mailslot1.Message = txtWriteMessage
  336.     Mailslot1.Action = MSLOT_WRITE
  337. End Sub
  338.  
  339. Sub Form_Load ()
  340.     lblNextMessage = "N/A"
  341.     lblNextSize = "N/A"
  342.     lblNextPriority = "N/A"
  343.  
  344.     lblUserName = Mailslot1.UserName
  345.     lblComputerName = Mailslot1.ComputerName
  346.     lblWorkgroupName = Mailslot1.WorkgroupName
  347. End Sub
  348.  
  349. Sub Timer1_Timer ()
  350.     Mailslot1.Action = MSLOT_PEEK
  351.  
  352.     ' make sure user can't read if no message waiting
  353.     btnRead.Enabled = (Mailslot1.Message <> "")
  354.  
  355.     If Len(Mailslot1.Message) > 0 Then
  356.         ' show data for waiting message
  357.         lblNextMessage = Mailslot1.Message
  358.     Else
  359.         ' no message display
  360.         lblNextMessage = "None"
  361.     End If
  362.  
  363.     lblNextSize = Format(Mailslot1.NextSize)
  364.     lblNextPriority = Format(Mailslot1.NextPriority)
  365. End Sub
  366.  
  367. Sub txtMailslotName_Change ()
  368.     txtWriteMailslotName = txtMailslotName
  369. End Sub
  370.  
  371.